package com.ting.test.algorithms.二叉树;

public class 递归遍历 {

    public static void main(String[] args) {

        xianxu(new TreeNode(3));
        zhongxu(new TreeNode(3));
        houxu(new TreeNode(3));
    }

    private static void xianxu(TreeNode head) {
        if(head==null){
            return;
        }

        System.out.println(head.val);
        xianxu(head.left);
        xianxu(head.right);

    }

    private static void zhongxu(TreeNode head) {
        if(head==null){
            return;
        }

        zhongxu(head.left);
        System.out.println(head.val);
        zhongxu(head.right);

    }

    private static void houxu(TreeNode head) {
        if(head==null){
            return;
        }

        System.out.println(head.val);
        houxu(head.right);
        houxu(head.left);

    }


}
